package com.beaven.model.model.api;

import java.util.Date;

/**
 * author: Beaven
 * time: 2017/5/18 10:52
 *
 * 返回model
 */

public class RspModel<T> {

  public static final int SUCCEED = 1;
  public static final int ERROR_UNKNOWN = 0;

  public static final int ERROR_NOT_FOUND_USER = 4041;
  public static final int ERROR_NOT_FOUND_GROUP = 4042;
  public static final int ERROR_NOT_FOUND_GROUP_MEMBER = 4043;

  public static final int ERROR_CREATE_USER = 3001;
  public static final int ERROR_CREATE_GROUP = 3002;
  public static final int ERROR_CREATE_MESSAGE = 3003;

  public static final int ERROR_PARAMETERS = 4001;
  public static final int ERROR_PARAMETERS_EXIST_ACCOUNT = 4002;
  public static final int ERROR_PARAMETERS_EXIST_NAME = 4003;

  public static final int ERROR_SERVICE = 5001;

  public static final int ERROR_ACCOUNT_TOKEN = 2001;
  public static final int ERROR_ACCOUNT_LOGIN = 2002;
  public static final int ERROR_ACCOUNT_REGISTER = 2003;

  public static final int ERROR_ACCOUNT_NO_PERMISSION = 2010;

  private int code;
  private String msg;
  private Date date;
  private T result;

  public int getCode() {
    return code;
  }

  public void setCode(int code) {
    this.code = code;
  }

  public String getMsg() {
    return msg;
  }

  public void setMsg(String msg) {
    this.msg = msg;
  }

  public Date getDate() {
    return date;
  }

  public void setDate(Date date) {
    this.date = date;
  }

  public T getResult() {
    return result;
  }

  public void setResult(T result) {
    this.result = result;
  }

  public boolean isSuccess() {
    return code == SUCCEED;
  }
}
